package com.juncdut.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class RibbonController {

    @Autowired
    private RestTemplate restTemplate;
    @Value("${server.port}")
    private String port;

    @GetMapping("/ribbon")
    public String ribbon(){
        String body = restTemplate.getForEntity("http://Hystrix/hystrix/hello", String.class).getBody();
        System.out.println("接收到信息："+body);
        System.out.println("ribbon-----port: "+port);
        return body;
    }
}
